package edu.sctu.zcy.month201505.day20150520;

/**
 * Created by user24 on 2015/5/20.
 */
public class TextOne extends TextMore {

    public TextOne(TeaCher[] teaChers) {

        super(teaChers);
    }


    public void getTeacher() {
        TeaCher[] teaChers1;
        teaChers1 = sortTeacher();
        System.out.println("教师排序后为：");

        for (int i = 0; i < teaChers1.length; i++) {
            //    int number,StringOne name,StringOne technicalTitle,StringOne course,StringOne sex,
            //          Student[] students

            System.out.println("工号：" + teaChers1[i].getNumber() + "  " + "姓名：" + teaChers1[i].getName() +

                    "  " + "职位：" + teaChers1[i].getTechnicalTitle() + "  " + "课程：" + teaChers1[i].getCourse() + "  " +

                    "性别：" + teaChers1[i].getSex());

            for (int j = 0; j < teaChers1[i].getStudents().length; j++) {
                System.out.println("所教学生姓名为：" + teaChers1[i].getStudents()[j].getName());
            }
        }

    }

    public Student[] getStudent(int code, Student[] students) {



        Student[] students1 = new Student[teaChers.length];
        System.out.println("职称为教授的学生且成绩大于code的有：");
        int k = 0;

            for (int j = 0; j < students.length; j++) {
                if (students[j] != null && students[j].getScore() >= code) {
                    students1[k] = students[j];
                    k++;
                }
            }

        return students1;
    }

    public Student[] getCode(InterFaceStudent interFaceStudent) {

        TeaCher[] teacher = pritCoded();
        Student[] students = new Student[teaChers.length * 2];

        int k = 0;
        for (int i = 0; i < teacher.length; i++) {
            if(teacher[i] != null) {

                for (int j = 0; j < teacher[i].getStudents().length; j++) {

                    students[k] = teacher[i].getStudents()[j];
                    k++;
                }
            }
        }
        interFaceStudent.print(students);
        return students;

    }
}



